<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="<s:url value="/css/common.css"/>" type="text/css"
	rel="stylesheet" />

<script type="text/javascript"
	src="<s:url value="/js/jquery-1.9.1.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.blockUI.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/jquery.validate.min.js" />"></script>
<script type="text/javascript"
	src="<s:url value="/js/pwms.validate.js?v13" />"></script>
<script language="javascript" type="text/javascript"
	src="<s:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript'
	src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>
<script type='text/javascript' src='<s:url value="/js/YLlightbox.js"/>'></script>
<script type='text/javascript' src='<s:url value="/js/ajaxfileupload.js"/>'></script>
<style type="text/css">
.error {
	color: red;
}
</style>

</head>

<body>
<s:hidden id="isMid" value="%{merinfo.busiRang}"></s:hidden>
<s:hidden id="orgCodes" value="%{#session.session_merchant.orgCode}"></s:hidden>
			<div id="caption">
			<table width="100%" class="tb">
			<tr class="tb-line">
				<td class="tb-td" colspan="4">
					<div class="tb-h2">POS收单运营管理平台</div>
				</td>
			</tr>
			<tr class="tb-line bg-gray">
				<td class="tb-td" colspan="4"><div class="tb-h3" id="title">开通扫码</div></td>
			</tr>
			</table>
			</div>
			<!-- basic -->

		<!-- 扫码信息模块 -->
		<div id="public">
		<s:form id="scanCodeAgain" action="/opcard/sendScanCodeAgain.ct" method="post" theme="simple">
			<table width="100%" class="tb">
				<tr class="tb-line">
					<td align="right" class="tb-td" style="width: 110px;">
						<div class="tb-h4">开通选项：</div>
					</td>
					<td class="tb-td" style="width: 480px;">
						<label class="tb-select">
				 			<s:select name="openType" list="#{'0':'支付宝扫码','1':'微信扫码'}" cssClass="queryWidth" id="openType"/> 
                		</label>	
					</td>
					<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">开通状态：</div>
				        	<s:hidden name="contact.mchtCd" ></s:hidden>
				        	<s:hidden name="contact.remark2" id="zfb"></s:hidden>
				        	<s:hidden name="contact.remark3" id="wx"></s:hidden>
			            </td>
			            <td class="tb-td" id="status">
                			
						</td>
				</tr>	
				<tr class="tb-line">
					<td align="right" class="tb-td" style="width: 110px;">
						<div class="tb-h4">商户号：</div>
					</td>
					<td class="tb-td" style="width: 480px;">
						<s:property value="merinfo.id"/>
					</td>
					<td align="right" class="tb-td" style="width: 110px;">
						<div class="tb-h4">商户名称：</div>
					</td>
					<td class="tb-td"><s:property value="merinfo.name"/>
					</td>
				</tr>				
			</table>
			
			<%-- <table width="100%" class="tb" style="display: none" id="wx_display">
				<tr class="tb-line">
					<td align="right" class="tb-td" style="width:110px;">
				        	<div class="tb-h4" id="title">联系人微信姓名：</div>
				        	<s:hidden id="cwxn" value="%{#request.wxName}"></s:hidden>
			            </td>
			            <td class="tb-td" style="width: 480px;">
                			<label class="tb-input-lengthen">
						<s:textfield maxLength="200" placeholder="微信名" name="yycard.wxName" cssClass="queryWidth" id="wxName"></s:textfield>
						</label>
						<font color="red" id="tipsn">*</font>
						</td>
						<td align="right" class="tb-td" style="width: 110px;">
						<div class="tb-h4">联系人微信号：</div>
						<s:hidden id="cwx" value="%{#request.wxNum}"></s:hidden>
					</td>
					<td class="tb-td">
					<label class="tb-input-lengthen">
						<s:textfield maxLength="200" placeholder="微信号" name="yycard.wx" cssClass="queryWidth" id="wxNum"></s:textfield>
						</label>
						<font color="red" id="tips">*</font>
					</td>
				</tr>				
			</table> --%>
			
			<table width="100%" border="0" cellspacing="0" class="table">
				<tr class="tb-line">
					<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
						<span style="color: red;"><s:actionmessage /></span> <span
						style="color: red;"><s:fielderror cssClass="fieldError" /></span>
						<span id="otherError"></span></td>
				</tr>
				<tr class="tb-line">
					<td class="tb-td line-submit" align="center" colspan="4">
					
					<div id="openBtn" style="display: none">
					<label class="tb-input-submit">
						<input type="button" id="btnCode" value="重新开通" />
					</label>
					<label class="tb-input-submit"> 
					<input type="reset" value="重置" id="resetCode" class="reset"/>
					</label>
					<label class="tb-input-submit"> 
						<input type="button" id="back" value="返回" onclick="history.back()"/>
					</label>
					</div>
					<div id="openBtnClose" style="display: none">
					<label class="tb-input-submit"> 
						<input type="button" value="返回" onclick="history.back()"/>
					</label>
					</div>
					</td>
				</tr>
			</table>
		</s:form>
		</div>	
	<s:if test="msg!=null">
	<script type="text/javascript">
    alert("${msg}");
	</script>
</s:if>
</body>

<script type="text/javascript">
$(function(){
	loadPage();
	$('#openType').change(function(){
		loadPage();
	});
	//加载参数
	function loadPage(){
		var type=$('#openType').val();
		if(type==0){
			$('#wx_display').css("display","none");
			//支付宝
			var zfb=$('#zfb').val();
			if(zfb==1){
				$('#status').text('开通成功');
				$('#openBtn').css("display","none");
				$('#openBtnClose').css("display","block");
			}else if(zfb==0){
				$('#status').text('开通失败');
				$('#openBtn').css("display","block");
				$('#openBtnClose').css("display","none");
			}else{
				$('#status').text('未知参数');
				$('#openBtn').css("display","none");
				$('#openBtnClose').css("display","block");
			}		
		}else{
			//微信
			var wx=$('#wx').val();
			if(wx==1 || wx==4){
				if(wx==1){
					$('#status').text('开通成功');
				}else{
					$('#status').text('开通审核中');
				}
				$('#openBtn').css("display","none");
				$('#openBtnClose').css("display","block");
				//$('#wx_display').css("display","none");
			}else if(wx==0 || wx==2 || wx==3){
				$('#status').text('开通失败');
				$('#openBtn').css("display","block");
				$('#openBtnClose').css("display","none");
				/* $('#wx_display').css("display","");
				if(wx==2 || wx==3){
					$('#wxNum').val($('#cwx').val());
					$('#wxName').val($('#cwxn').val());
					$('#wxNum').attr("disabled",true);
					$('#wxName').attr("disabled",true);
				}else{

				} */
				
			}else{
				$('#status').text('未知参数');
				$('#openBtn').css("display","none");
				$('#openBtnClose').css("display","block");
				$('#wx_display').css("display","none");
			}
		}
	}
	
	$('#btnCode').click(function(){
		/* var type=$('#openType').val();
		var wx_num=$('#wxNum').val().trim();
		var wx_name=$('#wxName').val().trim();
		var wx=$('#wx').val();
		if(wx==0 && type==1){
			if(wx_name==''){
				$('#tipsn').text("*微信名不能为空");
				return;
			}else{
				$('#tipsn').text("*");
			}
			
			if(wx_num==''){
				$('#tips').text("*微信号不能为空");
				return;
			}else{
				$('#tips').text("*");
			} 
		} */
		$("#scanCodeAgain").attr("action","<%=basePath%>/opcard/sendScanCodeAgain.ct");
		$("#scanCodeAgain").submit();
		$("#btnCode").attr("disabled",true);
		$("#resetCode").attr("disabled",true);
		$("#back").attr("disabled",true);
	});
});
</script>

</html>
